<template>
  <div class="beyond">
    <el-dialog title="提示" center @close="close" :visible.sync="isShow" >

      <el-form :model="form" ref='form' label-position="top">
        <template v-if='form.fileList.length > 1 && showSameDay'>
          <el-form-item
          label="是否同日提交">
            <el-radio-group v-model="form.isSameDay">
              <el-radio :label="1">是</el-radio>
              <el-radio :label="2">否</el-radio>
            </el-radio-group>
          </el-form-item>
        </template>

        <div class="tips" v-if="!showSameDay">
          <span class="font_danger">权利要求数超过10项的为超项数，小于等于10，超项数为0。</span>
        </div>

        <template v-if='showBeyond'>
          <el-form-item
            :label="item.name + ' 权利要求超项数'"
            prop="name" v-for="(item,index) in form.fileList"
            :key='index'>
            <el-input v-model.number="item.value"></el-input>
          </el-form-item>
        </template>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submit">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data () {
    return {
      isShow: false,
      form: {
        fileList: [
          // {
          //   name: '',
          //   value: 0
          // }
        ],
        isSameDay: 1
      },
      fileList: []
    }
  },
  props: {
    showSameDay: {
      type: Boolean,
      default: false
    },
    showBeyond: {
      type: Boolean,
      default: true
    }

  },
  methods: {
    show(data) {
      this.form.fileList = []
      for(let i = 0; i < data.length; i++) {
        let item = {
          name: data[i].name,
          value: 0
        }
        this.form.fileList.push(item)
      }
      this.isShow = true
    },
    submit () {
      this.$emit('submitPost', this.form)
      this.close()
    },
    close () {
      this.$refs['form'].resetFields
      this.isShow = false
    }
  }
}
</script>

<style lang='less' type='text/css'>
  .beyond {
    .tips {
      text-align: left;
    }
  }
</style>
